package main

import (
	"context"
	"userrpc/biz/service"
	user "userrpc/kitex_gen/user"
)

// UserServiceImpl implements the last service interface defined in the IDL.
type UserServiceImpl struct{}

// RegisterUser implements the UserServiceImpl interface.
func (s *UserServiceImpl) RegisterUser(ctx context.Context, user *user.User) (resp *user.Response, err error) {
	resp, err = service.NewRegisterUserService(ctx).Run(user)

	return resp, err
}

// Login implements the UserServiceImpl interface.
func (s *UserServiceImpl) Login(ctx context.Context, user *user.User) (resp *user.User, err error) {
	resp, err = service.NewLoginService(ctx).Run(user)

	return resp, err
}

// Logout implements the UserServiceImpl interface.
func (s *UserServiceImpl) Logout(ctx context.Context, user *user.User) (resp *user.Response, err error) {
	resp, err = service.NewLogoutService(ctx).Run(user)

	return resp, err
}

// EditPassword implements the UserServiceImpl interface.
func (s *UserServiceImpl) EditPassword(ctx context.Context, user *user.User) (resp *user.Response, err error) {
	resp, err = service.NewEditPasswordService(ctx).Run(user)

	return resp, err
}
